import React from 'react'
import { Button, Form, Input, Card, Space, Table } from 'antd'
import { SearchOutlined } from '@ant-design/icons'
import type { ColumnsType } from 'antd/lib/table'

interface DataType {
  id: number
  createTime: string
  updateTime: string
  isDeleted: number
  hosname: string
  hoscode: string
  apiUrl: string
  signKey: string
  contactsName: string
  contactsPhone: string
  status: number
}

const columns: ColumnsType<DataType> = [
  {
    title: '序号',
    render: (text, record, index) => index + 1,
  },
  {
    title: '医院名称',
    dataIndex: 'hosname',
  },
  {
    title: '医院编号',
    dataIndex: 'hoscode',
  },
  {
    title: 'api基础路径',
    dataIndex: 'apiUrl',
  },
  {
    title: '签名',
    dataIndex: 'signKey',
  },
  {
    title: '联系人名字',
    dataIndex: 'contactsName',
  },
  {
    title: '联系人电话',
    dataIndex: 'contactsPhone',
  },
]

const data: DataType[] = [
  {
    id: 82356,
    createTime: '2022-06-14 16:48:08',
    updateTime: '2022-06-14 16:48:08',
    isDeleted: 0,
    hosname: '测试专用',
    hoscode: '11111111111111111111111110',
    apiUrl: '11111111111111111',
    signKey: 'b430cb8643f170b91643631d256078c7',
    contactsName: '1111111111111111',
    contactsPhone: '18379078904',
    status: 1,
  },
  {
    id: 82357,
    createTime: '2022-06-14 16:48:08',
    updateTime: '2022-06-14 16:48:08',
    isDeleted: 0,
    hosname: '测试专用',
    hoscode: '11111111111111111111111110',
    apiUrl: '11111111111111111',
    signKey: 'b430cb8643f170b91643631d256078c7',
    contactsName: '1111111111111111',
    contactsPhone: '18379078904',
    status: 1,
  },
]

export default function HospitalSet() {
  const onFinish = (values: any) => {
    console.log('Success:', values)
  }

  return (
    <Card>
      <Space direction="vertical" size="large">
        <Form name="basic" onFinish={onFinish} layout={'inline'}>
          <Form.Item name="username">
            <Input placeholder="医院名称" />
          </Form.Item>

          <Form.Item name="password">
            <Input placeholder="医院编号" />
          </Form.Item>

          <Form.Item>
            <Button type="primary" htmlType="submit" icon={<SearchOutlined />}>
              搜索
            </Button>
          </Form.Item>

          <Form.Item>
            <Button>清空</Button>
          </Form.Item>
        </Form>
        <Space>
          <Button type="primary">添加</Button>
          <Button>批量删除</Button>
        </Space>
        <Table columns={columns} dataSource={data} rowKey="id"/>
      </Space>
    </Card>
  )
}
